package guoanmaker.operator.business.model;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;

import guoanmaker.operator.helper.common.abstractobj.IdEntity;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name="t_operator_user")
public class OperatorUser extends IdEntity implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@Column(name="name")
    private String name;
	@Column(name="username")
	private String username;
	@Column(name="password")
	private String password;
	@Column(name="user_email")
    private String userEmail;
	@Column(name="user_phone")
    private String userPhone;
	@Column(name="status")
    private Integer status;    // 0---正常 1---未激活 9---冻结 99---封禁
	@Column(name="logon_times")
    private Integer logonTimes;
	@Column(name="user_integral")
    private Integer userIntegral;
	@Column(name="last_logon_date")
    private Date lastLogonDate;
	@Column(name="last_logon_ip")
    private String lastLogonIp;
	@Column(name="create_date")
    private Date createDate;
	@Column(name="department_id")
    private String departmentId;
	@Column(name="role_id")
    private String roleId;
    @Column(name="depname")
    private  String depname;
    @Column(name="rolename")
    private  String rolename;
	
    @JsonIgnore
	@ManyToMany
    @JoinTable(name =  "t_operator_role_user",joinColumns = { @JoinColumn(name = "userid") }, inverseJoinColumns = {
            @JoinColumn(name = "roleid") })
    @JSONField(serialize=false)
    private Set<OperatorRole> roles;
	

}
